<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="com.alpha.bom.*" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="display" uri="http://displaytag.sf.net"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Results by Exam</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/displaytag.css"/>

</head>
<body>
<c:set var="user" value="${sessionScope.user}"></c:set>
<c:if test="${user.userType ne 'Professor'}" >
		<c:redirect url="LoginServlet"></c:redirect>
	</c:if>
<c:set var="exams" value="${requestScope.exams}"></c:set>
 
<div id="header"><%@ include file="Header.jsp"%></div>
<div id="content">
<div id="navbar"><%@ include file="NavigationBar.jsp"%></div>
<div id="main">
	
		<div class="box">
			<div class="box-header well">
				<h2><i class="icon-th-list"></i> Exams</h2>
				<div class="box-icon">
					<a href="#" class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
				</div>
			</div>
			<div class="box-content">
				<display:table id="exam" name="${exams}" export="true" class="table table-striped table-bordered bootstrap-datatable datatable">
					<display:column property="examName" title="Exam Name"/>
					<display:column property="category" title="Exam Category"/>
					<display:column property="numberOfStudents" title="Number of Takers"/>
					<display:column media="html" title="Action">
						<a class="btn btn-info" href="ExamReportServlet?exam_id=${exam.examId}"><i class=" icon-info-sign"></i> Exam Results</a>
					</display:column>
					
					<display:caption media="pdf excel csv xml rtf">Exam Results</display:caption>
					
					<display:setProperty name="export.pdf" value="true"/>
					<display:setProperty name="export.pdf.filename" value="export.pdf"/>
					<display:setProperty name="export.excel.filename" value="export.xls"/>
					<display:setProperty name="export.csv.filename" value="export.csv"/>
					<display:setProperty name="export.xml.filename" value="export.xml"/>
					<display:setProperty name="export.rtf.filename" value="export.rtf"/>

				</display:table>
			</div>
		</div>

</div>
</div>
<script>
	$(document).ready(function() {
		$("span[class*='export']").parent().each(function() {
			this.href = this.href.replace("ExamResults.jsp", "ExamResultsServlet");
		});
	});
</script>
</body>
</html>